package com.cold.legendary.bprocess.common.exception;

import com.cold.legendary.bprocess.common.constance.BErrorCodeEnum;

/**
 * @author cold
 * @since 2023/3/8
 */
public class BProcessException extends RuntimeException {

    private String code;
    private String msg;

    public BProcessException() {
        super();
        this.code = BErrorCodeEnum.ERROR.getCode();
        this.msg = BErrorCodeEnum.ERROR.getMsg();
    }

    public BProcessException(Throwable e) {
        super(e);
        this.code = BErrorCodeEnum.ERROR.getCode();
        this.msg = BErrorCodeEnum.ERROR.getMsg();
    }

    public BProcessException(BErrorCodeEnum bErrorCodeEnum) {
        super();
        this.code = bErrorCodeEnum.getCode();
        this.msg = bErrorCodeEnum.getMsg();
    }

    public BProcessException(BErrorCodeEnum bErrorCodeEnum, String message) {
        super();
        this.code = bErrorCodeEnum.getCode();
        this.msg = bErrorCodeEnum.getMsg() + "-" + message;
    }

    public BProcessException(BErrorCodeEnum bErrorCodeEnum, Throwable e) {
        super(e);
        this.code = bErrorCodeEnum.getCode();
        this.msg = bErrorCodeEnum.getMsg();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
